//
//  LeftImageField.m
//  Utils
//
//  Created by enghou on 2018/4/11.
//  Copyright © 2018年 xyxorigation. All rights reserved.
//

#import "LeftImageField.h"

@implementation LeftImageField

//-(void)setLeftImage:(UIImage *)leftImage{
//    if (leftImage) {
//        _leftImage = leftImage;
//        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 40, self.frame.size.height)];
//        view.backgroundColor = [UIColor whiteColor];
//        UIImageView *leftImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 25, 25)];
//        leftImageView.image = _leftImage;
//        leftImageView.contentMode = UIViewContentModeScaleAspectFit;
//        [view addSubview:leftImageView];
//        leftImageView.center = CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2);
//        self.leftView = view;
//        self.leftViewMode = UITextFieldViewModeAlways;
//    }
//}

-(void)setLeftTitle:(NSString *)leftTitle{
    if (leftTitle) {
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, self.frame.size.height)];
        view.backgroundColor = [UIColor clearColor];
        UILabel *label = [[UILabel alloc]init];
        label.text = leftTitle;
        label.textColor = [UIColor whiteColor];
        label.font = [UIFont systemFontOfSize:16];
        label.textAlignment = NSTextAlignmentCenter;
        label.frame = view.bounds;
        [view addSubview:label];
        self.leftView = view;
        self.leftViewMode = UITextFieldViewModeAlways;
    }
}

-(void)setBlackTitle:(NSString *)leftTitle{
    if (leftTitle) {
        UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 60, self.frame.size.height)];
        view.backgroundColor = [UIColor clearColor];
        UILabel *label = [[UILabel alloc]init];
        label.text = leftTitle;
        label.textColor = [UIColor whiteColor];
        label.font = [UIFont systemFontOfSize:16];
        label.textAlignment = NSTextAlignmentCenter;
        label.frame = view.bounds;
        [view addSubview:label];
        self.leftView = view;
        self.leftViewMode = UITextFieldViewModeAlways;
    }
}

-(void)setSeparatorColor:(UIColor *)separatorColor{
    if (separatorColor) {
        UIView *separator = [[UIView alloc]init];
        separator.backgroundColor = separatorColor;
        separator.frame = CGRectMake(0, self.frame.size.height - 0.5, ScreenWidth - 32, 0.5);
        [self addSubview:separator];
    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
